package com.cjg.xiancheng;

import java.util.concurrent.Callable;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.Future;
import java.util.concurrent.FutureTask;

public class Three {
    public static void main(String[] args) {
        FutureTask<Integer> futureTask =new FutureTask<Integer>(new one());
        new Thread(futureTask).start();
        try {
            Integer integer = futureTask.get();
            System.out.println(integer);
        } catch (InterruptedException e) {
            e.printStackTrace();
        } catch (ExecutionException e) {
            e.printStackTrace();
        }
    }
}

class  one implements Callable<Integer>{

    @Override
    public Integer call() throws Exception {
        System.out.println("callable");
        return 100;
    }
}
